#include <stdio.h>
#include <stdlib.h>

char s1[4] = {'k','e','n','t'};
//char jaggedArr[3][];
//jaggedArr[0] = {'f', 'o', 'o'};

char twoD[3][3] = {{'f', 'o', 'o'}, {'b', 'a', 'r'}, {'h', 'o', 'g'}};
int i, res;

int main(void) {


    // copy an array to another
    char *s2;
    s2 = s1;

    // try arr[-1], arr[-2]
    printf("arr[-1]: %d\n", s2[-1]);

    // manipulate 2D array with pointer
    char *s3;
    s3 = twoD + 2;
    printf("%d\n", *s3);
    printf("%c\n", *s3);

    // Rewrite  the  routines  day_of_year  and  month_day  with  pointers  instead  of  indexing

    // subtract two pointers to members of the same array
    char *s1k;
    char *s1n;
    s1k = &s1[0];
    s1n = &s1[2];
    res = s1n - s1k;
    printf("res: %d\n", res);

    for (i = 0; i < sizeof(s1); i++) {
        printf("%d\n", s2[i]);
        printf("%c\n", s2[i]);
    }

    return 0;
}